const LoadingSingleton = function () {
  this.mask = null
  this.initLoading()
}
// 初始化loading元素

LoadingSingleton.prototype.initLoading = function () {
  // 创建一个mask div
  // const mask = document.createElement('div')
  const mask = document.querySelector(".mask")
  // mask.classList.add('mask')
  this.mask = mask
  // 创建动画盒子
  const loadingBox = document.createElement('div')
  loadingBox.classList.add('loadingBox')
  mask.appendChild(loadingBox)
  // document.body.appendChild(mask)
}
// 显示loading
LoadingSingleton.prototype.showLoading = function () {
  this.mask.classList.add('show')
}
// 关闭loading
LoadingSingleton.prototype.hideLoading = function () {
  this.mask.classList.remove('show')
}
LoadingSingleton.getInstance = (function () {
  let instance = null
  return function () {
    if (!instance) {
      instance = new LoadingSingleton()
    }
    return instance
  }
})()
